package com.xiye.common.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;

/**
 * @author 西野
 * @version V1.0
 * @title ReflectHelper.java
 * @package com.xiye.common.util
 * @description 数据返回实体
 * @date 2018-07-23
 */
@ApiModel(description = "响应数据")
public class Result implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "状态码", name = "code", example = "200")
    private Integer code;//状态码
    @ApiModelProperty(value = "是否成功",name = "success", example = "true")
    private Boolean success;//状态
    @ApiModelProperty(value = "响应信息",name = "message", example = "操作成功")
    private String message;//消息
    @ApiModelProperty(value = "返回对象(pd通常存一些基本数据，Page通常存分页参数，QX通常存一些权限设置)",name = "result", example = "{\"pd\":{\"ROLE_ID\":\"1\"},\"QX\":{\"Datajur\":\"1\"},\"Page\":{\"showCount\":5}}")
    private Object result;//数据对象
    @ApiModelProperty(value = "时间戳",name = "timestamp", example = "1533707136560")
    private long timestamp = System.currentTimeMillis();

    /*
     * @Author 西野
     * @Date 2018-07-23 09:28:01
     * @Description 无参构造器
     * @Param []
     * @Return
     */
    public Result() {
        super();
    }

    /*
     * @Author 西野
     * @Date 2018-07-23 09:28:18
     * @Description 只返回状态，状态码，消息
     * @Param [success, code, massege]
     * @Return
     */
    public Result(Boolean success, Integer code, String message) {
        super();
        this.success = success;
        this.code = code;
        this.message = message;
    }

    /*
     * @Author 西野
     * @Date 2018-07-23 09:28:29
     * @Description 只返回状态，状态码，数据对象
     * @Param [success, code, result]
     * @Return
     */
    public Result(Boolean success, Integer code, Object result) {
        super();
        this.success = success;
        this.code = code;
        this.result = result;
    }

    /*
     * @Author 西野
     * @Date 2018-07-23 09:31:52
     * @Description 返回全部信息即状态，状态码，消息，数据对象
     * @Param [success, code, massege, result]
     * @Return
     */
    public Result(Boolean success, Integer code, String message, Object result) {
        super();
        this.success = success;
        this.code = code;
        this.message = message;
        this.result = result;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Boolean getSuccess() {
        return success;
    }

    public void setSuccess(Boolean success) {
        this.success = success;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getResult() {
        return result;
    }

    public void setResult(Object result) {
        this.result = result;
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }
}
